package com.gmlive.common.sample.update

import android.os.Bundle
import com.gmlive.common.appupdate.utils.UpdateUtils
import com.gmlive.common.sample.FileUtils
import com.gmlive.common.sample.R
import com.gmlive.common.ui.app.IkCompatActivity
import kotlinx.android.synthetic.main.activity_app_update.*

class AppUpdateActivity: IkCompatActivity() {

    companion object {
        const val UPDATE_URL = "https://gitee.com/svenjung/appupdate/raw/master/jsonapi/update_normal.json"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_app_update)

        update_button.setOnClickListener {
            AppUpdateUtils.checkNewVersion(this,"setting", UPDATE_URL)
        }

        update_clear_cache.setOnClickListener {
            FileUtils.deleteFile(UpdateUtils.getDiskCacheDir(this, "xupdate"))
        }
    }
}